import React, { Component } from 'react';
import { Router, Route, Switch , Redirect} from 'react-router';
import publicModel from '../publicModel/publicModel';
import history from '../utils/history';
import routerConf from '../conf/routerConf';
import MainLayout from '../layouts';
import User from '../pages/user';
import Login from '../pages/login_register/login';
import Register from '../pages/login_register/register';
import OverView from '../pages/overView/overView';
import FileExcel from '../pages/fileExcel';
import FilePdf from '../pages/filePdf';
import FilePPT from '../pages/filePPT';
import FileText from '../pages/fileText';
import FileWord from '../pages/fileWord';
import Music from '../pages/music';
import Others from '../pages/others';
import Picture from '../pages/picture';
import Video from '../pages/video';
class Index extends Component {

  render() {
    return (
      <Router history={history}>
        <Switch>
            <Route path={routerConf.user.path}>
                <User  history={history}/>
            </Route>
            <Route path={routerConf.login.path}>
                <Login  history={history}/>
            </Route>
            <Route path={routerConf.register.path}>
                <Register  history={history}/>
            </Route>
            <Route path={routerConf.overView.path}>
                <OverView  history={history}/>
            </Route>
            <Route path={routerConf.fileExcel.path}>
                <MainLayout>
                    <FileExcel  history={history}/>
                </MainLayout>
            </Route>
            <Route path={routerConf.filePdf.path}>
                <MainLayout>
                    <FilePdf  history={history}/>
                </MainLayout>
            </Route>
            <Route path={routerConf.filePPT.path}>
                <MainLayout>
                    <FilePPT  history={history}/>
                </MainLayout>
            </Route>
            <Route path={routerConf.fileText.path}>
                <MainLayout>
                    <FileText  history={history}/>
                </MainLayout>
            </Route>
            <Route path={routerConf.fileWord.path}>
                <MainLayout>
                    <FileWord  history={history}/>
                </MainLayout>
            </Route>
            <Route path={routerConf.music.path}>
                <MainLayout>
                    <Music  history={history}/>
                </MainLayout>
            </Route>
            <Route path={routerConf.others.path}>
                <MainLayout>
                    <Others  history={history}/>
                </MainLayout>
            </Route>
            <Route path={routerConf.picture.path}>
                <MainLayout>
                    <Picture  history={history}/>
                </MainLayout>
            </Route>
            <Route path={routerConf.video.path}>
                <MainLayout>
                    <Video  history={history}/>
                </MainLayout>
            </Route>
            <Redirect to={routerConf[publicModel.currentMenus[0]].path}/>
        </Switch>
      </Router>
    );
  }
}

export default Index;
